package com.zhanjixun.weixin.conts;

/**
 * @author :zhanjixun
 * @date : 2018/11/18 13:50
 */
public enum MsgType {
    TEXT(1, "文本消息"),
    IMAGE(3, "图片消息"),
    VOICE(34, "语音消息"),
    VERIFY(37, "验证消息"),
    POSSIBLE_FRIEND(40, "可能的朋友的消息"),
    SHARE_CARD(42, "共享名片"),
    VIDEO(43, "视频文件、小视频"),
    ANIMATED_STICKER(47, "动画表情"),
    LOCATION(48, "位置消息"),
    APP(49, "分享链接5、文件6、邀请进群 "),
    VOIP(50, "VoIP消息"),
    INIT(51, "初始化消息"),
    VOIP_NOTIFY(52, "VoIP通知"),
    VOIP_INVITE(53, "VoIP邀请"),
    //VIDEO(62, "小视频"),
    SYS_NOTICE(9999, "系统通知"),
    SYSTEM(10000, "系统消息"),
    REVOKE(10002, "撤回消息");

    private int code;
    private String desc;

    MsgType(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static MsgType getMsgTypeByCode(int code) {
        for (MsgType msgType : MsgType.values()) {
            if (code == msgType.getCode()) {
                return msgType;
            }
        }
        return null;
    }

}
